{% load i18n %}
{% load dbapp_tags %}
<div>

<div id="id_worktable_search_form">
  
  <div id="id_search" class="div_box" style="padding-bottom:2px !important;margin-bottom:2px !important;">
		<h1><div id="id_title"></div></h1>
		 <div>
			<table width="96%" class="tbl_form_search" id="id_form_search">
				<tr>
					<td>
						<div class="topSearchBtn" style="text-align:right;display:block;width:150px;">
						<span style="padding-right:10px;" class="Link_blue1 floatL displayB">
						<span class="action_topSearch floatL"></span>
							<a id="id_header_search" href="javascript:void(0)" class="floatL">{% trans "查询" %}</a>
						</span>
						<span  style="padding-right:10px;" class="Link_blue1 floatL displayB">
							<span class="action_topClear floatL"></span>
						<a id="id_header_clear" href="javascript:void(0)" class="floatL">{% trans "清除" %}</a>	
						</span>
						</div>
					</td>
				</tr>
			</table>
		 </div>
	</div>
	<div id="id_main_div">
		<table class="m_grid" id="flex" ></table>	
	</div>
</div>
</div>
<script>
	var model_url="{% autoescape off %}{{model_url}}{% endautoescape %}";
	var content_type__id="{% autoescape off %}{{content_type__id}}{% endautoescape %}";
	var $this_panel=$("#id_worktable_search_form");
	var m_util = new gridUtil($this_panel,"",[]);
	$(".m_grid",$this_panel).flexigrid({
		url: '/selfatt/grid/selfatt/Log/?content_type__id='+content_type__id+"&model_url="+model_url,
		dataType: 'json',
		type:"GET",
		colModel : [
			{display: gettext('用户'), name : 'username', width : 70, sortable : true, align: 'center'},
			{display: gettext('动作时间'), name : 'action_time', width : 120, sortable : true, align: 'center'},
			{display: gettext('对象类型'), name : 'name', width : 50, sortable : true, align: 'center'},
			{display: gettext('对象描述'), name : 'object_repr', width : 125, sortable : true, align: 'center'},
			{display: gettext('动作标识'), name : 'action_flag', width : 50, sortable : true, align: 'center',process:log_format},
			{display: gettext('改变消息'), name : 'change_message', width : 105, sortable : true, align: 'center'}
			],
		sortname: "username",
		sortorder: "asc",
		usepager: true,
		rp: 20,
		width: 600,
		height: 400
	});   
	
	function log_format(tdDiv, id){
		var t_tdDiv = $(tdDiv).html()
		if (t_tdDiv =="1"){
			$(tdDiv).html(gettext('增加'));
		}else if(t_tdDiv =="2"){
			$(tdDiv).html(gettext('修改'));
		}else if(t_tdDiv =="3"){
			$(tdDiv).html(gettext('删除'));
		}else if(t_tdDiv =="4"){
			$(tdDiv).html(gettext('其他'));
		}else if(t_tdDiv =="6"){
			$(tdDiv).html(gettext('导出'));
		}
	}
</script>